package cnhy.salary.domain.dto;

import com.easy.query.core.annotation.EasyWhereCondition;
import com.easy.query.core.annotation.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.var;

import java.util.Date;

@Data
@Table("v_attendance_list")
public class AttendanceListDto extends EmployeeDto{

    ////0正常、1迟到、2缺卡,10补卡,20事假，21病假
    @ApiModelProperty(value = "考勤结果归类名称",notes = "正常、迟到、缺卡,请假")
    public String getTypeLabel() {
        var item = this;
        if (!StringUtils.isBlank(item.getLeaveType())) {
            return "请假";
        }
        if (item.getAttendanceResult() == null)
            return "";
        if (item.getAttendanceResult() == 0)
            return "正常";
        else if (item.getAttendanceResult() == 1)
            return "迟到";
        else if (item.getAttendanceResult() == 2)
            return "缺卡";
        else if (item.getAttendanceResult() == 10)
            return "正常";
        return "";
    }

    String emplName;
    @ApiModelProperty(value = "请假类型",notes = "0事假，1病假")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    String leaveType;
    @ApiModelProperty(value = "考勤结果",notes = "0正常、1迟到、2缺卡,10补卡")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    Integer attendanceResult;
    @ApiModelProperty(value = "考勤归属日格式化",notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.LIKE_MATCH_LEFT)
    String dateFmt;
    @ApiModelProperty(value = "考勤归属日期",notes = "")
    Date dayDate;

}
